package  
{
	import org.flixel.*;
	
	/**
	 * ...
	 * @author Lachlan McInnes
	 */
	public class LightParticle extends FlxSprite
	{
		//enumeration
		public static const UP:String = "up";
		public static const DOWN:String = "down";
		public static const LEFT:String = "left";
		public static const RIGHT:String = "right";
		
		private const particleWidth:uint = 5;
		private const particleHeight:uint = 5;
		private const particleSpeed:uint = 10;
		
		private var moveDirection:String = DOWN;
		
		public function LightParticle() 
		{
			makeGraphic(particleWidth, particleHeight, Color.White);
			alpha = 1;
		}
		
		override public function update():void 
		{
			switch(moveDirection)
			{
			case UP:
				y -= FlxG.elapsed * particleSpeed;
				break;
			case DOWN:
				y += FlxG.elapsed * particleSpeed;
				break;
			case LEFT:
				x -= FlxG.elapsed * particleSpeed;
				break;
			case RIGHT:
				x += FlxG.elapsed * particleSpeed;
				break;
			}
		}
		
		public function setColor(newColor:uint):void
		{
			color = newColor;
		}
		
		public function setDirection(direction:String):void
		{
			if (direction == "up" || direction == "Up" || direction == "UP")
			{
				moveDirection = UP;
			}
			else if (direction == "down" || direction == "Down" || direction == "DOWN")
			{
				moveDirection = DOWN;
			} 
			else if (direction == "left" || direction == "Left" || direction == "LEFT")
			{
				moveDirection = LEFT;
			}
			else if (direction == "right" || direction == "Right" || direction == "RIGHT")
			{
				moveDirection = RIGHT;
			}
		}
		
	}

}